[Top] [Prev] [Next] [Bottom] [Contents]

Troubleshooting

Parsing

There some problems associated with certain programs from third-party vendors related to HTML sites and activators. In addition, Sapphire/Web's parsing places one or two restrictions on their use:

Some HTML authoring tools will insert <CR><LF> pairs within an activator tag in an effort to make the string fit within an 80-character limit. This break is usually placed between the initial "A" and the subsequent "HREF". Sapphire/Web will not "see" such activators. The cure for this somewhat perverse activity is to remove all such breaks with a text editor, such as the tag editor that comes with Sapphire/Web.

If you place a data site as the very first characters in an HTML file - as an include used with an Sa_FILE= tag, perhaps - it will not be "seen" by Sapphire/Web. To avoid this, place some spaces or blank lines first.

Updating a Form

Sometimes you wish to accept information from the user and just change the data on the form accordingly. This appears to be impossible, according to the HTML specification. However, you can take advantage of the fact that the user will not see that a new page is being displayed if it is exactly the same as the previous one. In fact, if most of the page remains the same, the perception will be that only parts have changed.

You can achieve this with a form in the following way:

In the bind code editor (initialization section), initialize a variable:

char* value;
In the before object bind code, make an assignment:

value = SaGetInputValue("FormElementName");
Add something like this to your HTML for each field that you wish to populate:

<INPUT NAME="test" TYPE=text VALUE=##Sa_datasitename##> 
and use

SaRegisterStringSite(HtmlTemplate,"test",value)
to populate the datasite.

You must make the results template for the bind the same as the original HTML template or make it an identical copy. This will give the appearance that the fields were updated, but in reality the entire page was regenerated.

Showing String Variables

For debugging or other reasons you may wish to display a variable from within your server application in your HTML document. To do this:

1. Define a datasite in your HTML Template as ##Sa_DataSiteName##.
2. In the activator code editor (before or after bind code sections, depending on where you define the local variable) call the API function
char* LocalVarValue
...
LocalVarValue="some value"
SaRegisterStringSite(NULL,"datasitename",LocalVarValue)
For detailed information on this API, please see the Reference Manual, Chapter 2. This will populate the datasite with the value of the local variable LocalVarValue.

Error Handling

The default error handling for a Sapphire/Web-generated server application is to print the errors at the top of the returned HTML file. You can change this default behavior by making a call to the function SaRegStdErrSite. This function will send all errors to a Data Site in your HTML template with the name ##Sa_ErrorSite##. If you want a different name for your standard error site, use the function SaRegErrSite. This uses the SaRegErrSite function internally. You can look at the code for these functions in the file SaHtmlC.c in the directory client/src in the Sapphire/Web distribution.



[Top] [Prev] [Next] [Bottom] [Contents]

info@bluestone.com
Copyright © 1997, Bluestone. All rights reserved.